﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Hxj.Data;
using System.Data;
using RecruitStudents.Utility.Helper;
using RecruitStudents.Utility.Model;

namespace RecruitStudents.Client.DAL
{
    public class DALExaminee : Base.BaseService
    {
        public DataTable GetExameeSpeciality_ExamLevelBySignUpID_New(string strSignUpID)
        {
            string strSql = @"
                select a.*,b.SpecialityKindsNameAS as SpecialityKindsName,c.DicName,d.ExamPlaceName from
                (
                select distinct SUBSTRING(SpecialityKindsNO, 0, LEN(SpecialityKindsNO) - 1) as SpecNewNo, SignUpID, ExamYear, ExamLevel, ExamPlaceNO, AllowExamID, IsFee_First from TB_Exam_SignUpStudentsSpeciality where IsActive='1' and SignUpID = '{0}'
                ) as a 
                left join (select distinct SpecialityKindsID, SpecialityKindsNameAS from TB_Sys_SpecialityKinds) as b on a.SpecNewNo = b.SpecialityKindsID 
                left join TB_Dic_ExamLevel as c on a.ExamLevel = c.DicNO 
                left join TB_Sys_ExamPlace as d on a.ExamPlaceNO = d.ExamPlaceNO 
                 ";
            strSql = string.Format(strSql, strSignUpID);
            return GetTable(strSql);
        }
        public DataTable GetExameeNetPayFeeDataTable_New(WhereClip clip)
        {
            return DbHelper.GetDatabase().From<TB_Exam_SignUpStudentsSpeciality>() //选择表
                                       .Select(TB_Exam_SignUpStudentsSpeciality._.All)  //设置选择的字段数目 
                                       .LeftJoin<TB_SignUpStudents>(TB_Exam_SignUpStudentsSpeciality._.SignUpID == TB_SignUpStudents._.SignUpID)
                                       .Where(clip)
                                       .ToDataTable();   //返回List

        }

        #region 获取 考生报考专业 财务订单付款信息(根据考生ID)
        public DataTable GetExameeSpeciality_NetPayFeeInfo_BySignUpID(WhereClip clip)
        {
            return DbHelper.GetDatabase().From<TB_Exam_SignUpStudentsSpeciality>() //选择表
                  .LeftJoin<TB_SignUpStudentsNetPayFee_Head>(TB_Exam_SignUpStudentsSpeciality._.OrderNo_First == TB_SignUpStudentsNetPayFee_Head._.OrdNO)
                  .LeftJoin<TB_Sys_SpecialityKinds>(TB_Exam_SignUpStudentsSpeciality._.SpecialityKindsNO == TB_Sys_SpecialityKinds._.SpecialityKindsNO)
                  .LeftJoin<TB_Sys_ExamPlace>(TB_Exam_SignUpStudentsSpeciality._.ExamPlaceNO == TB_Sys_ExamPlace._.ExamPlaceNO)
                  .Select(TB_Exam_SignUpStudentsSpeciality._.All, TB_Sys_SpecialityKinds._.SpecialityKindsName, TB_SignUpStudentsNetPayFee_Head._.PaySource, TB_Sys_ExamPlace._.ExamPlaceName)  //设置选择的字段数目 
                  .Where(clip)
                  .ToDataTable();   //返回List

        }
        #endregion

        public DataTable GetNetPayFeeInfo_BySignUpID(WhereClip clip)
        {
            return DbHelper.GetDatabase().From<TB_SignUpStudentsNetPayFee_Head>() //选择表
                  .Select(TB_SignUpStudentsNetPayFee_Head._.All)  //设置选择的字段数目 
                  .Where(clip)
                  .ToDataTable();   //返回List
        }

        public DataTable GetNetPayFeeDetail_ByOrdNO(WhereClip clip)
        {
            return DbHelper.GetDatabase().From<TB_SignUpStudentsNetPayFee_Detail>() //选择表
                .LeftJoin<TB_Sys_SpecialityKinds>(TB_Sys_SpecialityKinds._.SpecialityKindsNO == TB_SignUpStudentsNetPayFee_Detail._.SpecialityKindsNO)
                .LeftJoin<TB_Dic_ExamLevel>(TB_Dic_ExamLevel._.DicNO == TB_SignUpStudentsNetPayFee_Detail._.ExamLevel)
                .Select(TB_SignUpStudentsNetPayFee_Detail._.All, TB_Sys_SpecialityKinds._.SpecialityKindsName, TB_Dic_ExamLevel._.DicName)  //设置选择的字段数目 
                .Where(clip)
                .ToDataTable();   //返回List
        }

        #region 获取 考生报考专业,考试级别信息
        public DataTable GetExameeSpeciality_ExamLevelBySignUpID(WhereClip clip)
        {
            return DbHelper.GetDatabase().From<TB_Exam_SignUpStudentsSpeciality>() //选择表
                                       .LeftJoin<TB_Sys_SpecialityKinds>(TB_Sys_SpecialityKinds._.SpecialityKindsNO == TB_Exam_SignUpStudentsSpeciality._.SpecialityKindsNO)
                                       .LeftJoin<TB_Dic_ExamLevel>(TB_Dic_ExamLevel._.DicNO == TB_Exam_SignUpStudentsSpeciality._.ExamLevel)
                                       .LeftJoin<TB_Sys_ExamPlace>(TB_Sys_ExamPlace._.ExamPlaceNO == TB_Exam_SignUpStudentsSpeciality._.ExamPlaceNO)
                                        .LeftJoin<TB_Sys_ExamPlaceSpecialityKindsGroupMapping>(TB_Sys_ExamPlaceSpecialityKindsGroupMapping._.GroupNo == TB_Exam_SignUpStudentsSpeciality._.AppointmentGroup_First)
                                        .LeftJoin<TB_Exam_Result>(TB_Exam_SignUpStudentsSpeciality._.SignUpStudentsSpecialityID == TB_Exam_Result._.SignUpStudentsSpecialityID && TB_Exam_SignUpStudentsSpeciality._.AllowExamID == TB_Exam_Result._.AllowExamID)
                                       .Select(TB_Exam_SignUpStudentsSpeciality._.All, TB_Sys_SpecialityKinds._.SpecialityKindsName, TB_Dic_ExamLevel._.DicName,
                                              TB_Sys_ExamPlace._.ExamPlaceName, TB_Sys_ExamPlaceSpecialityKindsGroupMapping._.GroupName,
                                              TB_Exam_Result._.ScoreTotal, TB_Exam_Result._.Sort) //设置选择的字段数目 
                                       .Where(clip)
                                       .ToDataTable();   //返回List
        }
        #endregion

        #region 获取 考试时间(通用方法)
        public string GetExamTime(string strExamArea, string strSpecialityKindsNO)
        {
            WhereClip clip = new WhereClip();
            clip = clip.And(View_ExamPlaceSpecialityKindsGroupMapping._.ExamPlaceNO == strExamArea);
            clip = clip.And(View_ExamPlaceSpecialityKindsGroupMapping._.SpecialityKindsNO == strSpecialityKindsNO);
            clip = clip.And(View_ExamPlaceSpecialityKindsGroupMapping._.ActualAcount < View_ExamPlaceSpecialityKindsGroupMapping._.TotalAcount);
            string strExamTime = "";
            try
            {
                DataTable dt = DbHelper.GetDatabase().From<View_ExamPlaceSpecialityKindsGroupMapping>() //选择表
                                       .Select(View_ExamPlaceSpecialityKindsGroupMapping._.All)  //设置选择的字段数目 
                                       .Where(clip)
                                       .OrderBy(new OrderByClip(View_ExamPlaceSpecialityKindsGroupMapping._.Sort))
                                       .ToDataTable();   //返回List

                if (dt.Rows.Count > 0)
                {
                    strExamTime = dt.Rows[0]["GroupNo"].ToString().Trim();
                }
                else
                {
                    WhereClip clip2 = new WhereClip();
                    clip2 = clip2.And(View_ExamPlaceSpecialityKindsGroupMapping._.ExamPlaceNO == strExamArea);
                    clip2 = clip2.And(View_ExamPlaceSpecialityKindsGroupMapping._.SpecialityKindsNO == strSpecialityKindsNO);

                    DataTable dt2 = DbHelper.GetDatabase().From<View_ExamPlaceSpecialityKindsGroupMapping>() //选择表
                                           .Select(View_ExamPlaceSpecialityKindsGroupMapping._.All)  //设置选择的字段数目 
                                           .Where(clip2)
                                           .OrderBy(new OrderByClip(View_ExamPlaceSpecialityKindsGroupMapping._.Sort))
                                           .ToDataTable();   //返回List
                    if (dt2.Rows.Count > 0)
                    {
                        strExamTime = dt2.Rows[0]["GroupNo"].ToString().Trim();
                    }
                }
            }
            catch { }
            return strExamTime;

        }
        #endregion

        #region 保存 缴费确认的信息 （现场报名）
        public bool UpdateSpecialityInfoState(List<TB_Exam_SignUpStudentsSpeciality> StudentSpecialityInfo, Hxj.Data.DbTrans trans)
        {
            bool bo = false;
            if (StudentSpecialityInfo != null)
            {
                if (StudentSpecialityInfo.Count > 0)
                {

                    foreach (TB_Exam_SignUpStudentsSpeciality model in StudentSpecialityInfo)
                    {
                        Dictionary<Field, object> dic = new Dictionary<Field, object>();

                        dic.Add(TB_Exam_SignUpStudentsSpeciality._.SignUpStudentsSpecialityID, model.SignUpStudentsSpecialityID);
                        dic.Add(TB_Exam_SignUpStudentsSpeciality._.IsFee_First, model.IsFee_First);
                        dic.Add(TB_Exam_SignUpStudentsSpeciality._.SignUpID, model.SignUpID);
                        dic.Add(TB_Exam_SignUpStudentsSpeciality._.ExamLevel, model.ExamLevel);
                        dic.Add(TB_Exam_SignUpStudentsSpeciality._.IsActive, model.IsActive);
                        dic.Add(TB_Exam_SignUpStudentsSpeciality._.OrderNo_First, model.OrderNo_First);
                        dic.Add(TB_Exam_SignUpStudentsSpeciality._.SpecialityKindsNO, model.SpecialityKindsNO);
                        dic.Add(TB_Exam_SignUpStudentsSpeciality._.ExamPlaceNO, model.ExamPlaceNO);
                        dic.Add(TB_Exam_SignUpStudentsSpeciality._.SignUpType, model.SignUpType);
                        dic.Add(TB_Exam_SignUpStudentsSpeciality._.ExamYear, model.ExamYear);
                        dic.Add(TB_Exam_SignUpStudentsSpeciality._.CreatTime, model.CreatTime);
                        dic.Add(TB_Exam_SignUpStudentsSpeciality._.AllowExamID, model.AllowExamID);

                        //考试分组
                        string strExamTime = GetExamTime(model.ExamPlaceNO, model.SpecialityKindsNO);
                        dic.Add(TB_Exam_SignUpStudentsSpeciality._.AppointmentGroup_First, strExamTime);

                        bo = DbHelper.GetDatabase().Update<TB_Exam_SignUpStudentsSpeciality>(dic, TB_Exam_SignUpStudentsSpeciality._.SignUpStudentsSpecialityID == model.SignUpStudentsSpecialityID) == 1 ? true : false;


                    }

                }
            }
            return bo;
        }
        #endregion
        public void UploadPhoto(TB_SignUpStudentsPhoto model, DbTrans trans)
        {
            if (model.SignUpStudentsID != "")
            {
                DbHelper.GetDatabase().Delete<TB_SignUpStudentsPhoto>(TB_SignUpStudentsPhoto._.SignUpStudentsID == model.SignUpStudentsID, trans);
            }
            if (!model.IsNewModel)
            {
                DbHelper.GetDatabase().Update<TB_SignUpStudentsPhoto>(model, trans);
            }
            else
            {
                DbHelper.GetDatabase().Insert<TB_SignUpStudentsPhoto>(model, trans);
            }
        }

        #region 获取 考生相关信息（专业信息查询）
        public DataTable GetExamineeOfAllInfo(PagerCondition pager, string strExamLevel)
        {
            DataTable dt = new DataTable();
            if (strExamLevel == "1")
            {
                pager.RecordCount = DbHelper.GetDatabase().From<TB_Exam_SignUpStudentsSpeciality>() //选择表
                        .LeftJoin<TB_SignUpStudents>(TB_Exam_SignUpStudentsSpeciality._.SignUpID == TB_SignUpStudents._.SignUpID)
                        .LeftJoin<TB_SignUpStudentsNetPayFee_Head>(TB_Exam_SignUpStudentsSpeciality._.OrderNo_First == TB_SignUpStudentsNetPayFee_Head._.OrdNO && TB_SignUpStudentsNetPayFee_Head._.IsFeeSuccess == "1")
                        .LeftJoin<TB_SignUpStudentsNetPayFee_Detail>(TB_SignUpStudentsNetPayFee_Detail._.OrdNO == TB_Exam_SignUpStudentsSpeciality._.OrderNo_First
                        && TB_SignUpStudentsNetPayFee_Detail._.SpecialityKindsNO == TB_Exam_SignUpStudentsSpeciality._.SpecialityKindsNO)
                        .LeftJoin<TB_Sys_SpecialityKinds>(TB_Exam_SignUpStudentsSpeciality._.SpecialityKindsNO == TB_Sys_SpecialityKinds._.SpecialityKindsNO)
                        .LeftJoin<TB_Sys_ExamPlace>(TB_Exam_SignUpStudentsSpeciality._.ExamPlaceNO == TB_Sys_ExamPlace._.ExamPlaceNO)
                        .LeftJoin<TB_Dic_ExamProvince>(TB_Dic_ExamProvince._.DicNO == TB_SignUpStudents._.ExamProvince)
                        .LeftJoin<TB_Sys_ExamPlaceSpecialityKindsGroupMapping>(TB_Sys_ExamPlaceSpecialityKindsGroupMapping._.GroupNo == TB_Exam_SignUpStudentsSpeciality._.AppointmentGroup_First)
                        .Where(pager.ComplexSearchCondition)
                        .Count();
                pager.OtherData = DbHelper.GetDatabase().From<TB_Exam_SignUpStudentsSpeciality>() //选择表
                        .LeftJoin<TB_SignUpStudents>(TB_Exam_SignUpStudentsSpeciality._.SignUpID == TB_SignUpStudents._.SignUpID)
                        .LeftJoin<TB_SignUpStudentsNetPayFee_Head>(TB_Exam_SignUpStudentsSpeciality._.OrderNo_First == TB_SignUpStudentsNetPayFee_Head._.OrdNO && TB_SignUpStudentsNetPayFee_Head._.IsFeeSuccess == "1")
                        .LeftJoin<TB_SignUpStudentsNetPayFee_Detail>(TB_SignUpStudentsNetPayFee_Detail._.OrdNO == TB_Exam_SignUpStudentsSpeciality._.OrderNo_First
                        && TB_SignUpStudentsNetPayFee_Detail._.SpecialityKindsNO == TB_Exam_SignUpStudentsSpeciality._.SpecialityKindsNO
                        )
                        .LeftJoin<TB_Sys_SpecialityKinds>(TB_Exam_SignUpStudentsSpeciality._.SpecialityKindsNO == TB_Sys_SpecialityKinds._.SpecialityKindsNO)
                        .LeftJoin<TB_Sys_ExamPlace>(TB_Exam_SignUpStudentsSpeciality._.ExamPlaceNO == TB_Sys_ExamPlace._.ExamPlaceNO)
                        .LeftJoin<TB_Dic_ExamProvince>(TB_Dic_ExamProvince._.DicNO == TB_SignUpStudents._.ExamProvince)
                        .LeftJoin<TB_Sys_ExamPlaceSpecialityKindsGroupMapping>(TB_Sys_ExamPlaceSpecialityKindsGroupMapping._.GroupNo == TB_Exam_SignUpStudentsSpeciality._.AppointmentGroup_First)
                        .Select(TB_SignUpStudentsNetPayFee_Detail._.Fee.Sum())
                        .Where(pager.ComplexSearchCondition).ToScalar().ToString();

                #region 固定写法，判断当前页面对象删除后，当前页和最大页之间的关系
                if (pager.CurrentPage > pager.PageCount)
                {
                    pager.CurrentPage = pager.PageCount;
                }
                if (pager.OrderBy == null)
                    pager.OrderBy = new OrderByClip(TB_Exam_SignUpStudentsSpeciality._.CreatTime, OrderByOperater.DESC);
                #endregion
                dt = DbHelper.GetDatabase().From<TB_Exam_SignUpStudentsSpeciality>() //选择表
                        .LeftJoin<TB_SignUpStudents>(TB_Exam_SignUpStudentsSpeciality._.SignUpID == TB_SignUpStudents._.SignUpID)
                        .LeftJoin<TB_SignUpStudentsNetPayFee_Head>(TB_Exam_SignUpStudentsSpeciality._.OrderNo_First == TB_SignUpStudentsNetPayFee_Head._.OrdNO && TB_SignUpStudentsNetPayFee_Head._.IsFeeSuccess == "1")
                        .LeftJoin<TB_SignUpStudentsNetPayFee_Detail>(TB_SignUpStudentsNetPayFee_Detail._.OrdNO == TB_Exam_SignUpStudentsSpeciality._.OrderNo_First
                        && TB_SignUpStudentsNetPayFee_Detail._.SpecialityKindsNO == TB_Exam_SignUpStudentsSpeciality._.SpecialityKindsNO
                        )
                        .LeftJoin<TB_Sys_SpecialityKinds>(TB_Exam_SignUpStudentsSpeciality._.SpecialityKindsNO == TB_Sys_SpecialityKinds._.SpecialityKindsNO)
                        .LeftJoin<TB_Sys_ExamPlace>(TB_Exam_SignUpStudentsSpeciality._.ExamPlaceNO == TB_Sys_ExamPlace._.ExamPlaceNO)
                        .LeftJoin<TB_Dic_ExamProvince>(TB_Dic_ExamProvince._.DicNO == TB_SignUpStudents._.ExamProvince)
                        .LeftJoin<TB_Sys_ExamPlaceSpecialityKindsGroupMapping>(TB_Sys_ExamPlaceSpecialityKindsGroupMapping._.GroupNo == TB_Exam_SignUpStudentsSpeciality._.AppointmentGroup_First)
                        .Select(TB_Exam_SignUpStudentsSpeciality._.All, TB_Dic_ExamProvince._.DicName, TB_SignUpStudentsNetPayFee_Detail._.Fee, TB_Sys_ExamPlaceSpecialityKindsGroupMapping._.GroupName,
                        TB_SignUpStudents._.Name, TB_SignUpStudents._.LinkMobile, TB_SignUpStudents._.IdentityCard, TB_SignUpStudents._.NMT_SignUpID, TB_SignUpStudents._.Sex, TB_SignUpStudents._.ExamProvince,
                        TB_Sys_SpecialityKinds._.SpecialityKindsName, TB_SignUpStudentsNetPayFee_Head._.PaySource, TB_Sys_ExamPlace._.ExamPlaceName)  //设置选择的字段数目 
                         .AddSelect(
                                     DbHelper.GetDatabase().From<TB_Dic_ExamLevel>()
                                     .Where(TB_Dic_ExamLevel._.DicNO == TB_Exam_SignUpStudentsSpeciality._.ExamLevel)
                                     .Select(TB_Dic_ExamLevel._.DicName), "ExamLevelName"
                                     )
                        .Page(pager.PageSize, pager.CurrentPage)  //分页显示
                        .Where(pager.ComplexSearchCondition)
                                        .OrderBy(pager.OrderBy)   //排序
                        .ToDataTable();   //返回List
            }
            else if (strExamLevel == "2")
            {
                pager.RecordCount = DbHelper.GetDatabase().From<TB_Exam_SignUpStudentsSpeciality>() //选择表
                        .LeftJoin<TB_SignUpStudents>(TB_Exam_SignUpStudentsSpeciality._.SignUpID == TB_SignUpStudents._.SignUpID)
                        .LeftJoin<TB_SignUpStudentsNetPayFee_Head>(TB_Exam_SignUpStudentsSpeciality._.OrderNo_Second == TB_SignUpStudentsNetPayFee_Head._.OrdNO && TB_SignUpStudentsNetPayFee_Head._.IsFeeSuccess == "1")
                        .LeftJoin<TB_SignUpStudentsNetPayFee_Detail>(TB_SignUpStudentsNetPayFee_Detail._.OrdNO == TB_SignUpStudentsNetPayFee_Head._.OrdNO
                          && TB_SignUpStudentsNetPayFee_Detail._.SpecialityKindsNO == TB_Exam_SignUpStudentsSpeciality._.SpecialityKindsNO)
                        .LeftJoin<TB_Sys_SpecialityKinds>(TB_Exam_SignUpStudentsSpeciality._.SpecialityKindsNO == TB_Sys_SpecialityKinds._.SpecialityKindsNO)
                        .LeftJoin<TB_Sys_ExamPlace>(TB_Exam_SignUpStudentsSpeciality._.ExamPlaceNO == TB_Sys_ExamPlace._.ExamPlaceNO)
                        .LeftJoin<TB_Dic_ExamProvince>(TB_Dic_ExamProvince._.DicNO == TB_SignUpStudents._.ExamProvince)
                        .LeftJoin<TB_Sys_ExamPlaceSpecialityKindsGroupMapping>(TB_Sys_ExamPlaceSpecialityKindsGroupMapping._.GroupNo == TB_Exam_SignUpStudentsSpeciality._.AppointmentGroup_Second)
                        .Where(pager.ComplexSearchCondition)
                        .Count();
                pager.OtherData = DbHelper.GetDatabase().From<TB_Exam_SignUpStudentsSpeciality>() //选择表
                      .LeftJoin<TB_SignUpStudents>(TB_Exam_SignUpStudentsSpeciality._.SignUpID == TB_SignUpStudents._.SignUpID)
                      .LeftJoin<TB_SignUpStudentsNetPayFee_Head>(TB_Exam_SignUpStudentsSpeciality._.OrderNo_First == TB_SignUpStudentsNetPayFee_Head._.OrdNO && TB_SignUpStudentsNetPayFee_Head._.IsFeeSuccess == "1")
                      .LeftJoin<TB_SignUpStudentsNetPayFee_Detail>(TB_SignUpStudentsNetPayFee_Detail._.OrdNO == TB_Exam_SignUpStudentsSpeciality._.OrderNo_First
                      && TB_SignUpStudentsNetPayFee_Detail._.SpecialityKindsNO == TB_Exam_SignUpStudentsSpeciality._.SpecialityKindsNO
                      )
                      .LeftJoin<TB_Sys_SpecialityKinds>(TB_Exam_SignUpStudentsSpeciality._.SpecialityKindsNO == TB_Sys_SpecialityKinds._.SpecialityKindsNO)
                      .LeftJoin<TB_Sys_ExamPlace>(TB_Exam_SignUpStudentsSpeciality._.ExamPlaceNO == TB_Sys_ExamPlace._.ExamPlaceNO)
                      .LeftJoin<TB_Dic_ExamProvince>(TB_Dic_ExamProvince._.DicNO == TB_SignUpStudents._.ExamProvince)
                      .LeftJoin<TB_Sys_ExamPlaceSpecialityKindsGroupMapping>(TB_Sys_ExamPlaceSpecialityKindsGroupMapping._.GroupNo == TB_Exam_SignUpStudentsSpeciality._.AppointmentGroup_First)
                      .Select(TB_SignUpStudentsNetPayFee_Detail._.Fee.Sum())
                      .Where(pager.ComplexSearchCondition).ToScalar().ToString();
                #region 固定写法，判断当前页面对象删除后，当前页和最大页之间的关系
                if (pager.CurrentPage > pager.PageCount)
                {
                    pager.CurrentPage = pager.PageCount;
                }
                if (pager.OrderBy == null)
                    pager.OrderBy = new OrderByClip(TB_Exam_SignUpStudentsSpeciality._.CreatTime, OrderByOperater.DESC);
                #endregion
                dt = DbHelper.GetDatabase().From<TB_Exam_SignUpStudentsSpeciality>() //选择表
                        .LeftJoin<TB_SignUpStudents>(TB_Exam_SignUpStudentsSpeciality._.SignUpID == TB_SignUpStudents._.SignUpID)
                        .LeftJoin<TB_SignUpStudentsNetPayFee_Head>(TB_Exam_SignUpStudentsSpeciality._.OrderNo_Second == TB_SignUpStudentsNetPayFee_Head._.OrdNO && TB_SignUpStudentsNetPayFee_Head._.IsFeeSuccess == "1")
                        .LeftJoin<TB_SignUpStudentsNetPayFee_Detail>(TB_SignUpStudentsNetPayFee_Detail._.OrdNO == TB_SignUpStudentsNetPayFee_Head._.OrdNO
                          && TB_SignUpStudentsNetPayFee_Detail._.SpecialityKindsNO == TB_Exam_SignUpStudentsSpeciality._.SpecialityKindsNO)
                        .LeftJoin<TB_Sys_SpecialityKinds>(TB_Exam_SignUpStudentsSpeciality._.SpecialityKindsNO == TB_Sys_SpecialityKinds._.SpecialityKindsNO)
                        .LeftJoin<TB_Sys_ExamPlace>(TB_Exam_SignUpStudentsSpeciality._.ExamPlaceNO == TB_Sys_ExamPlace._.ExamPlaceNO)
                        .LeftJoin<TB_Dic_ExamProvince>(TB_Dic_ExamProvince._.DicNO == TB_SignUpStudents._.ExamProvince)
                        .LeftJoin<TB_Sys_ExamPlaceSpecialityKindsGroupMapping>(TB_Sys_ExamPlaceSpecialityKindsGroupMapping._.GroupNo == TB_Exam_SignUpStudentsSpeciality._.AppointmentGroup_Second)
                        .Select(TB_Exam_SignUpStudentsSpeciality._.All, TB_Dic_ExamProvince._.DicName, TB_SignUpStudentsNetPayFee_Detail._.Fee, TB_Sys_ExamPlaceSpecialityKindsGroupMapping._.GroupName,
                        TB_SignUpStudents._.Name, TB_SignUpStudents._.LinkMobile, TB_SignUpStudents._.IdentityCard, TB_SignUpStudents._.NMT_SignUpID, TB_SignUpStudents._.Sex, TB_SignUpStudents._.ExamProvince,
                        TB_Sys_SpecialityKinds._.SpecialityKindsName, TB_SignUpStudentsNetPayFee_Head._.PaySource, TB_Sys_ExamPlace._.ExamPlaceName)  //设置选择的字段数目 
                         .AddSelect(
                                     DbHelper.GetDatabase().From<TB_Dic_ExamLevel>()
                                     .Where(TB_Dic_ExamLevel._.DicNO == TB_Exam_SignUpStudentsSpeciality._.ExamLevel)
                                     .Select(TB_Dic_ExamLevel._.DicName), "ExamLevelName"
                                     )
                        .Page(pager.PageSize, pager.CurrentPage)  //分页显示
                        .Where(pager.ComplexSearchCondition)
                        .OrderBy(pager.OrderBy)   //排序
                        .ToDataTable();   //返回List
            }
            else if (strExamLevel == "3")
            {
                pager.RecordCount = DbHelper.GetDatabase().From<TB_Exam_SignUpStudentsSpeciality>() //选择表
                        .LeftJoin<TB_SignUpStudents>(TB_Exam_SignUpStudentsSpeciality._.SignUpID == TB_SignUpStudents._.SignUpID)
                        .LeftJoin<TB_SignUpStudentsNetPayFee_Head>(TB_Exam_SignUpStudentsSpeciality._.OrderNo_Third == TB_SignUpStudentsNetPayFee_Head._.OrdNO && TB_SignUpStudentsNetPayFee_Head._.IsFeeSuccess == "1")
                        .LeftJoin<TB_SignUpStudentsNetPayFee_Detail>(TB_SignUpStudentsNetPayFee_Detail._.OrdNO == TB_SignUpStudentsNetPayFee_Head._.OrdNO
                          && TB_SignUpStudentsNetPayFee_Detail._.SpecialityKindsNO == TB_Exam_SignUpStudentsSpeciality._.SpecialityKindsNO)
                        .LeftJoin<TB_Sys_SpecialityKinds>(TB_Exam_SignUpStudentsSpeciality._.SpecialityKindsNO == TB_Sys_SpecialityKinds._.SpecialityKindsNO)
                        .LeftJoin<TB_Sys_ExamPlace>(TB_Exam_SignUpStudentsSpeciality._.ExamPlaceNO == TB_Sys_ExamPlace._.ExamPlaceNO)
                        .LeftJoin<TB_Dic_ExamProvince>(TB_Dic_ExamProvince._.DicNO == TB_SignUpStudents._.ExamProvince)
                        .LeftJoin<TB_Sys_ExamPlaceSpecialityKindsGroupMapping>(TB_Sys_ExamPlaceSpecialityKindsGroupMapping._.GroupNo == TB_Exam_SignUpStudentsSpeciality._.AppointmentGroup_Third)
                        .Where(pager.ComplexSearchCondition)
                        .Count();
                pager.OtherData = DbHelper.GetDatabase().From<TB_Exam_SignUpStudentsSpeciality>() //选择表
                      .LeftJoin<TB_SignUpStudents>(TB_Exam_SignUpStudentsSpeciality._.SignUpID == TB_SignUpStudents._.SignUpID)
                      .LeftJoin<TB_SignUpStudentsNetPayFee_Head>(TB_Exam_SignUpStudentsSpeciality._.OrderNo_First == TB_SignUpStudentsNetPayFee_Head._.OrdNO && TB_SignUpStudentsNetPayFee_Head._.IsFeeSuccess == "1")
                      .LeftJoin<TB_SignUpStudentsNetPayFee_Detail>(TB_SignUpStudentsNetPayFee_Detail._.OrdNO == TB_Exam_SignUpStudentsSpeciality._.OrderNo_First
                      && TB_SignUpStudentsNetPayFee_Detail._.SpecialityKindsNO == TB_Exam_SignUpStudentsSpeciality._.SpecialityKindsNO)
                      .LeftJoin<TB_Sys_SpecialityKinds>(TB_Exam_SignUpStudentsSpeciality._.SpecialityKindsNO == TB_Sys_SpecialityKinds._.SpecialityKindsNO)
                      .LeftJoin<TB_Sys_ExamPlace>(TB_Exam_SignUpStudentsSpeciality._.ExamPlaceNO == TB_Sys_ExamPlace._.ExamPlaceNO)
                      .LeftJoin<TB_Dic_ExamProvince>(TB_Dic_ExamProvince._.DicNO == TB_SignUpStudents._.ExamProvince)
                      .LeftJoin<TB_Sys_ExamPlaceSpecialityKindsGroupMapping>(TB_Sys_ExamPlaceSpecialityKindsGroupMapping._.GroupNo == TB_Exam_SignUpStudentsSpeciality._.AppointmentGroup_First)
                      .Select(TB_SignUpStudentsNetPayFee_Detail._.Fee.Sum())
                      .Where(pager.ComplexSearchCondition).ToScalar().ToString();
                #region 固定写法，判断当前页面对象删除后，当前页和最大页之间的关系
                if (pager.CurrentPage > pager.PageCount)
                {
                    pager.CurrentPage = pager.PageCount;
                }
                if (pager.OrderBy == null)
                    pager.OrderBy = new OrderByClip(TB_Exam_SignUpStudentsSpeciality._.CreatTime, OrderByOperater.DESC);
                #endregion
                dt = DbHelper.GetDatabase().From<TB_Exam_SignUpStudentsSpeciality>() //选择表
                        .LeftJoin<TB_SignUpStudents>(TB_Exam_SignUpStudentsSpeciality._.SignUpID == TB_SignUpStudents._.SignUpID)
                        .LeftJoin<TB_SignUpStudentsNetPayFee_Head>(TB_Exam_SignUpStudentsSpeciality._.OrderNo_Third == TB_SignUpStudentsNetPayFee_Head._.OrdNO && TB_SignUpStudentsNetPayFee_Head._.IsFeeSuccess == "1")
                        .LeftJoin<TB_SignUpStudentsNetPayFee_Detail>(TB_SignUpStudentsNetPayFee_Detail._.OrdNO == TB_SignUpStudentsNetPayFee_Head._.OrdNO
                          && TB_SignUpStudentsNetPayFee_Detail._.SpecialityKindsNO == TB_Exam_SignUpStudentsSpeciality._.SpecialityKindsNO)
                        .LeftJoin<TB_Sys_SpecialityKinds>(TB_Exam_SignUpStudentsSpeciality._.SpecialityKindsNO == TB_Sys_SpecialityKinds._.SpecialityKindsNO)
                        .LeftJoin<TB_Sys_ExamPlace>(TB_Exam_SignUpStudentsSpeciality._.ExamPlaceNO == TB_Sys_ExamPlace._.ExamPlaceNO)
                        .LeftJoin<TB_Dic_ExamProvince>(TB_Dic_ExamProvince._.DicNO == TB_SignUpStudents._.ExamProvince)
                        .LeftJoin<TB_Sys_ExamPlaceSpecialityKindsGroupMapping>(TB_Sys_ExamPlaceSpecialityKindsGroupMapping._.GroupNo == TB_Exam_SignUpStudentsSpeciality._.AppointmentGroup_Third)
                        .Select(TB_Exam_SignUpStudentsSpeciality._.All, TB_Dic_ExamProvince._.DicName, TB_SignUpStudentsNetPayFee_Detail._.Fee, TB_Sys_ExamPlaceSpecialityKindsGroupMapping._.GroupName,
                        TB_SignUpStudents._.Name, TB_SignUpStudents._.LinkMobile, TB_SignUpStudents._.IdentityCard, TB_SignUpStudents._.NMT_SignUpID, TB_SignUpStudents._.Sex, TB_SignUpStudents._.ExamProvince,
                        TB_Sys_SpecialityKinds._.SpecialityKindsName, TB_SignUpStudentsNetPayFee_Head._.PaySource, TB_Sys_ExamPlace._.ExamPlaceName)  //设置选择的字段数目 
                         .AddSelect(
                                     DbHelper.GetDatabase().From<TB_Dic_ExamLevel>()
                                     .Where(TB_Dic_ExamLevel._.DicNO == TB_Exam_SignUpStudentsSpeciality._.ExamLevel)
                                     .Select(TB_Dic_ExamLevel._.DicName), "ExamLevelName"
                                     )
                        .Page(pager.PageSize, pager.CurrentPage)  //分页显示
                        .Where(pager.ComplexSearchCondition)
                                        .OrderBy(pager.OrderBy)   //排序
                        .ToDataTable();   //返回List
            }
            else
            {
                pager.RecordCount = DbHelper.GetDatabase().From<TB_Exam_SignUpStudentsSpeciality>() //选择表
                       .LeftJoin<TB_SignUpStudents>(TB_Exam_SignUpStudentsSpeciality._.SignUpID == TB_SignUpStudents._.SignUpID)
                       .LeftJoin<TB_SignUpStudentsNetPayFee_Head>((TB_Exam_SignUpStudentsSpeciality._.OrderNo_First == TB_SignUpStudentsNetPayFee_Head._.OrdNO && TB_SignUpStudentsNetPayFee_Head._.IsFeeSuccess == "1")
                          || (TB_Exam_SignUpStudentsSpeciality._.OrderNo_Second == TB_SignUpStudentsNetPayFee_Head._.OrdNO && TB_SignUpStudentsNetPayFee_Head._.IsFeeSuccess == "1")
                          || (TB_Exam_SignUpStudentsSpeciality._.OrderNo_Third == TB_SignUpStudentsNetPayFee_Head._.OrdNO && TB_SignUpStudentsNetPayFee_Head._.IsFeeSuccess == "1"))
                       .LeftJoin<TB_SignUpStudentsNetPayFee_Detail>(
                       TB_SignUpStudentsNetPayFee_Detail._.OrdNO == TB_SignUpStudentsNetPayFee_Head._.OrdNO
                       && TB_SignUpStudentsNetPayFee_Detail._.SpecialityKindsNO == TB_Exam_SignUpStudentsSpeciality._.SpecialityKindsNO)
                       .LeftJoin<TB_Sys_SpecialityKinds>(TB_Exam_SignUpStudentsSpeciality._.SpecialityKindsNO == TB_Sys_SpecialityKinds._.SpecialityKindsNO)
                       .LeftJoin<TB_Sys_ExamPlace>(TB_Exam_SignUpStudentsSpeciality._.ExamPlaceNO == TB_Sys_ExamPlace._.ExamPlaceNO)
                       .LeftJoin<TB_Dic_ExamProvince>(TB_Dic_ExamProvince._.DicNO == TB_SignUpStudents._.ExamProvince)
                       .LeftJoin<TB_Sys_ExamPlaceSpecialityKindsGroupMapping>(
                       TB_Sys_ExamPlaceSpecialityKindsGroupMapping._.GroupNo == TB_Exam_SignUpStudentsSpeciality._.AppointmentGroup_First
                       || TB_Sys_ExamPlaceSpecialityKindsGroupMapping._.GroupNo == TB_Exam_SignUpStudentsSpeciality._.AppointmentGroup_Second
                       || TB_Sys_ExamPlaceSpecialityKindsGroupMapping._.GroupNo == TB_Exam_SignUpStudentsSpeciality._.AppointmentGroup_Third)
                        .Where(pager.ComplexSearchCondition)
                        .Count();
                pager.OtherData = DbHelper.GetDatabase().From<TB_Exam_SignUpStudentsSpeciality>() //选择表
                      .LeftJoin<TB_SignUpStudents>(TB_Exam_SignUpStudentsSpeciality._.SignUpID == TB_SignUpStudents._.SignUpID)
                      .LeftJoin<TB_SignUpStudentsNetPayFee_Head>((TB_Exam_SignUpStudentsSpeciality._.OrderNo_First == TB_SignUpStudentsNetPayFee_Head._.OrdNO && TB_SignUpStudentsNetPayFee_Head._.IsFeeSuccess == "1")
                          || (TB_Exam_SignUpStudentsSpeciality._.OrderNo_Second == TB_SignUpStudentsNetPayFee_Head._.OrdNO && TB_SignUpStudentsNetPayFee_Head._.IsFeeSuccess == "1")
                          || (TB_Exam_SignUpStudentsSpeciality._.OrderNo_Third == TB_SignUpStudentsNetPayFee_Head._.OrdNO && TB_SignUpStudentsNetPayFee_Head._.IsFeeSuccess == "1"))
                      .LeftJoin<TB_SignUpStudentsNetPayFee_Detail>(TB_SignUpStudentsNetPayFee_Detail._.OrdNO == TB_Exam_SignUpStudentsSpeciality._.OrderNo_First
                      && TB_SignUpStudentsNetPayFee_Detail._.SpecialityKindsNO == TB_Exam_SignUpStudentsSpeciality._.SpecialityKindsNO
                      )
                      .LeftJoin<TB_Sys_SpecialityKinds>(TB_Exam_SignUpStudentsSpeciality._.SpecialityKindsNO == TB_Sys_SpecialityKinds._.SpecialityKindsNO)
                      .LeftJoin<TB_Sys_ExamPlace>(TB_Exam_SignUpStudentsSpeciality._.ExamPlaceNO == TB_Sys_ExamPlace._.ExamPlaceNO)
                      .LeftJoin<TB_Dic_ExamProvince>(TB_Dic_ExamProvince._.DicNO == TB_SignUpStudents._.ExamProvince)
                      .LeftJoin<TB_Sys_ExamPlaceSpecialityKindsGroupMapping>(TB_Sys_ExamPlaceSpecialityKindsGroupMapping._.GroupNo == TB_Exam_SignUpStudentsSpeciality._.AppointmentGroup_First)
                      .Select(TB_SignUpStudentsNetPayFee_Detail._.Fee.Sum())
                      .Where(pager.ComplexSearchCondition).ToScalar().ToString();
                #region 固定写法，判断当前页面对象删除后，当前页和最大页之间的关系
                if (pager.CurrentPage > pager.PageCount)
                {
                    pager.CurrentPage = pager.PageCount;
                }
                if (pager.OrderBy == null)
                    pager.OrderBy = new OrderByClip(TB_Exam_SignUpStudentsSpeciality._.CreatTime, OrderByOperater.DESC);
                #endregion
                dt = DbHelper.GetDatabase().From<TB_Exam_SignUpStudentsSpeciality>() //选择表
                       .LeftJoin<TB_SignUpStudents>(TB_Exam_SignUpStudentsSpeciality._.SignUpID == TB_SignUpStudents._.SignUpID)
                       .LeftJoin<TB_SignUpStudentsNetPayFee_Head>((TB_Exam_SignUpStudentsSpeciality._.OrderNo_First == TB_SignUpStudentsNetPayFee_Head._.OrdNO && TB_SignUpStudentsNetPayFee_Head._.IsFeeSuccess == "1")
                          || (TB_Exam_SignUpStudentsSpeciality._.OrderNo_Second == TB_SignUpStudentsNetPayFee_Head._.OrdNO && TB_SignUpStudentsNetPayFee_Head._.IsFeeSuccess == "1")
                          || (TB_Exam_SignUpStudentsSpeciality._.OrderNo_Third == TB_SignUpStudentsNetPayFee_Head._.OrdNO && TB_SignUpStudentsNetPayFee_Head._.IsFeeSuccess == "1"))
                       .LeftJoin<TB_SignUpStudentsNetPayFee_Detail>(
                       TB_SignUpStudentsNetPayFee_Detail._.OrdNO == TB_SignUpStudentsNetPayFee_Head._.OrdNO
                       && TB_SignUpStudentsNetPayFee_Detail._.SpecialityKindsNO == TB_Exam_SignUpStudentsSpeciality._.SpecialityKindsNO
                       )
                       .LeftJoin<TB_Sys_SpecialityKinds>(TB_Exam_SignUpStudentsSpeciality._.SpecialityKindsNO == TB_Sys_SpecialityKinds._.SpecialityKindsNO)
                       .LeftJoin<TB_Sys_ExamPlace>(TB_Exam_SignUpStudentsSpeciality._.ExamPlaceNO == TB_Sys_ExamPlace._.ExamPlaceNO)
                       .LeftJoin<TB_Dic_ExamProvince>(TB_Dic_ExamProvince._.DicNO == TB_SignUpStudents._.ExamProvince)
                       .LeftJoin<TB_Sys_ExamPlaceSpecialityKindsGroupMapping>(
                       TB_Sys_ExamPlaceSpecialityKindsGroupMapping._.GroupNo == TB_Exam_SignUpStudentsSpeciality._.AppointmentGroup_First
                       || TB_Sys_ExamPlaceSpecialityKindsGroupMapping._.GroupNo == TB_Exam_SignUpStudentsSpeciality._.AppointmentGroup_Second
                       || TB_Sys_ExamPlaceSpecialityKindsGroupMapping._.GroupNo == TB_Exam_SignUpStudentsSpeciality._.AppointmentGroup_Third)
                       .Select(TB_Exam_SignUpStudentsSpeciality._.All, TB_Dic_ExamProvince._.DicName, TB_SignUpStudentsNetPayFee_Detail._.Fee, TB_Sys_ExamPlaceSpecialityKindsGroupMapping._.GroupName,
                       TB_SignUpStudents._.Name, TB_SignUpStudents._.LinkMobile, TB_SignUpStudents._.IdentityCard, TB_SignUpStudents._.NMT_SignUpID, TB_SignUpStudents._.Sex, TB_SignUpStudents._.ExamProvince,
                       TB_Sys_SpecialityKinds._.SpecialityKindsName, TB_SignUpStudentsNetPayFee_Head._.PaySource, TB_Sys_ExamPlace._.ExamPlaceName)  //设置选择的字段数目 
                        .AddSelect(
                                    DbHelper.GetDatabase().From<TB_Dic_ExamLevel>()
                                    .Where(TB_Dic_ExamLevel._.DicNO == TB_Exam_SignUpStudentsSpeciality._.ExamLevel)
                                    .Select(TB_Dic_ExamLevel._.DicName), "ExamLevelName"
                                    )
                        .Page(pager.PageSize, pager.CurrentPage)  //分页显示
                       .Where(pager.ComplexSearchCondition)
                                        .OrderBy(pager.OrderBy)   //排序
                       .ToDataTable();   //返回List

            }
            return dt;
        }
        #endregion


        #region 获取 考生相关信息（专业信息查询） 胡国胜  2016-07-18
        public DataTable GetExamineeOfAllInfo_New(PagerCondition pager, string strExamLevel)
        {
            DataTable dt = new DataTable();
            //if (strExamLevel == "1")
            //{
            //    DbHelper.GetDatabase().From<TB_Exam_SignUpStudentsSpeciality>()
            //        .LeftJoin<TB_SignUpStudents>(TB_Exam_SignUpStudentsSpeciality._.SignUpID == TB_SignUpStudents._.SignUpID)
            //        .LeftJoin<TB_SignUpStudentsNetPayFee_Head>(TB_Exam_SignUpStudentsSpeciality._.OrderNo_First == TB_SignUpStudentsNetPayFee_Head._.OrdNO && TB_SignUpStudentsNetPayFee_Head._.IsFeeSuccess == "1")
            //        .LeftJoin<TB_Dic_ExamLevel>(TB_Exam_SignUpStudentsSpeciality._.ExamLevel == TB_Dic_ExamLevel._.DicNO)
            //        .LeftJoin<TB_Sys_SpecialityKinds>(TB_Exam_SignUpStudentsSpeciality._.SpecialityKindsNO == TB_Sys_SpecialityKinds._.SpecialityKindsNO)
            //        .LeftJoin<TB_Sys_ExamPlace>(TB_Exam_SignUpStudentsSpeciality._.ExamPlaceNO == TB_Sys_ExamPlace._.ExamPlaceNO)
            //        .LeftJoin<TB_Dic_ExamProvince>(TB_SignUpStudents._.ExamProvince == TB_Dic_ExamProvince._.DicNO)
            //        .LeftJoin<TB_Sys_ExamPlaceSpecialityKindsGroupMapping>(TB_Exam_SignUpStudentsSpeciality._.AppointmentGroup_First == TB_Sys_ExamPlaceSpecialityKindsGroupMapping._.GroupNo)
            //        .Count();
            //}
            //else if (strExamLevel == "2")
            //{ 
            //}
            //else if (strExamLevel == "3")
            //{ 
            //}
            //else
            //{
            //    pager.RecordCount = DbHelper.GetDatabase().From<TB_Exam_SignUpStudentsSpeciality>() //选择表
            //           .LeftJoin<TB_SignUpStudents>(TB_Exam_SignUpStudentsSpeciality._.SignUpID == TB_SignUpStudents._.SignUpID)
            //           .LeftJoin<TB_SignUpStudentsNetPayFee_Head>((TB_Exam_SignUpStudentsSpeciality._.OrderNo_First == TB_SignUpStudentsNetPayFee_Head._.OrdNO && TB_SignUpStudentsNetPayFee_Head._.IsFeeSuccess == "1")
            //              || (TB_Exam_SignUpStudentsSpeciality._.OrderNo_Second == TB_SignUpStudentsNetPayFee_Head._.OrdNO && TB_SignUpStudentsNetPayFee_Head._.IsFeeSuccess == "1")
            //              || (TB_Exam_SignUpStudentsSpeciality._.OrderNo_Third == TB_SignUpStudentsNetPayFee_Head._.OrdNO && TB_SignUpStudentsNetPayFee_Head._.IsFeeSuccess == "1"))
            //           .LeftJoin<TB_SignUpStudentsNetPayFee_Detail>(
            //           TB_SignUpStudentsNetPayFee_Detail._.OrdNO == TB_SignUpStudentsNetPayFee_Head._.OrdNO
            //           && TB_SignUpStudentsNetPayFee_Detail._.SpecialityKindsNO == TB_Exam_SignUpStudentsSpeciality._.SpecialityKindsNO)
            //           .LeftJoin<TB_Sys_SpecialityKinds>(TB_Exam_SignUpStudentsSpeciality._.SpecialityKindsNO == TB_Sys_SpecialityKinds._.SpecialityKindsNO)
            //           .LeftJoin<TB_Sys_ExamPlace>(TB_Exam_SignUpStudentsSpeciality._.ExamPlaceNO == TB_Sys_ExamPlace._.ExamPlaceNO)
            //           .LeftJoin<TB_Dic_ExamProvince>(TB_Dic_ExamProvince._.DicNO == TB_SignUpStudents._.ExamProvince)
            //           .LeftJoin<TB_Sys_ExamPlaceSpecialityKindsGroupMapping>(
            //           TB_Sys_ExamPlaceSpecialityKindsGroupMapping._.GroupNo == TB_Exam_SignUpStudentsSpeciality._.AppointmentGroup_First
            //           || TB_Sys_ExamPlaceSpecialityKindsGroupMapping._.GroupNo == TB_Exam_SignUpStudentsSpeciality._.AppointmentGroup_Second
            //           || TB_Sys_ExamPlaceSpecialityKindsGroupMapping._.GroupNo == TB_Exam_SignUpStudentsSpeciality._.AppointmentGroup_Third)
            //            .Where(pager.ComplexSearchCondition)
            //            .Count();
            //    pager.OtherData = DbHelper.GetDatabase().From<TB_Exam_SignUpStudentsSpeciality>() //选择表
            //          .LeftJoin<TB_SignUpStudents>(TB_Exam_SignUpStudentsSpeciality._.SignUpID == TB_SignUpStudents._.SignUpID)
            //          .LeftJoin<TB_SignUpStudentsNetPayFee_Head>((TB_Exam_SignUpStudentsSpeciality._.OrderNo_First == TB_SignUpStudentsNetPayFee_Head._.OrdNO && TB_SignUpStudentsNetPayFee_Head._.IsFeeSuccess == "1")
            //              || (TB_Exam_SignUpStudentsSpeciality._.OrderNo_Second == TB_SignUpStudentsNetPayFee_Head._.OrdNO && TB_SignUpStudentsNetPayFee_Head._.IsFeeSuccess == "1")
            //              || (TB_Exam_SignUpStudentsSpeciality._.OrderNo_Third == TB_SignUpStudentsNetPayFee_Head._.OrdNO && TB_SignUpStudentsNetPayFee_Head._.IsFeeSuccess == "1"))
            //          .LeftJoin<TB_SignUpStudentsNetPayFee_Detail>(TB_SignUpStudentsNetPayFee_Detail._.OrdNO == TB_Exam_SignUpStudentsSpeciality._.OrderNo_First
            //          && TB_SignUpStudentsNetPayFee_Detail._.SpecialityKindsNO == TB_Exam_SignUpStudentsSpeciality._.SpecialityKindsNO
            //          )
            //          .LeftJoin<TB_Sys_SpecialityKinds>(TB_Exam_SignUpStudentsSpeciality._.SpecialityKindsNO == TB_Sys_SpecialityKinds._.SpecialityKindsNO)
            //          .LeftJoin<TB_Sys_ExamPlace>(TB_Exam_SignUpStudentsSpeciality._.ExamPlaceNO == TB_Sys_ExamPlace._.ExamPlaceNO)
            //          .LeftJoin<TB_Dic_ExamProvince>(TB_Dic_ExamProvince._.DicNO == TB_SignUpStudents._.ExamProvince)
            //          .LeftJoin<TB_Sys_ExamPlaceSpecialityKindsGroupMapping>(TB_Sys_ExamPlaceSpecialityKindsGroupMapping._.GroupNo == TB_Exam_SignUpStudentsSpeciality._.AppointmentGroup_First)
            //          .Select(TB_SignUpStudentsNetPayFee_Detail._.Fee.Sum())
            //          .Where(pager.ComplexSearchCondition).ToScalar().ToString();
            //    #region 固定写法，判断当前页面对象删除后，当前页和最大页之间的关系
            //    if (pager.CurrentPage > pager.PageCount)
            //    {
            //        pager.CurrentPage = pager.PageCount;
            //    }
            //    if (pager.OrderBy == null)
            //        pager.OrderBy = new OrderByClip(TB_Exam_SignUpStudentsSpeciality._.CreatTime, OrderByOperater.DESC);
            //    #endregion
            //    dt = DbHelper.GetDatabase().From<TB_Exam_SignUpStudentsSpeciality>() //选择表
            //           .LeftJoin<TB_SignUpStudents>(TB_Exam_SignUpStudentsSpeciality._.SignUpID == TB_SignUpStudents._.SignUpID)
            //           .LeftJoin<TB_SignUpStudentsNetPayFee_Head>((TB_Exam_SignUpStudentsSpeciality._.OrderNo_First == TB_SignUpStudentsNetPayFee_Head._.OrdNO && TB_SignUpStudentsNetPayFee_Head._.IsFeeSuccess == "1")
            //              || (TB_Exam_SignUpStudentsSpeciality._.OrderNo_Second == TB_SignUpStudentsNetPayFee_Head._.OrdNO && TB_SignUpStudentsNetPayFee_Head._.IsFeeSuccess == "1")
            //              || (TB_Exam_SignUpStudentsSpeciality._.OrderNo_Third == TB_SignUpStudentsNetPayFee_Head._.OrdNO && TB_SignUpStudentsNetPayFee_Head._.IsFeeSuccess == "1"))
            //           .LeftJoin<TB_SignUpStudentsNetPayFee_Detail>(
            //           TB_SignUpStudentsNetPayFee_Detail._.OrdNO == TB_SignUpStudentsNetPayFee_Head._.OrdNO
            //           && TB_SignUpStudentsNetPayFee_Detail._.SpecialityKindsNO == TB_Exam_SignUpStudentsSpeciality._.SpecialityKindsNO
            //           )
            //           .LeftJoin<TB_Sys_SpecialityKinds>(TB_Exam_SignUpStudentsSpeciality._.SpecialityKindsNO == TB_Sys_SpecialityKinds._.SpecialityKindsNO)
            //           .LeftJoin<TB_Sys_ExamPlace>(TB_Exam_SignUpStudentsSpeciality._.ExamPlaceNO == TB_Sys_ExamPlace._.ExamPlaceNO)
            //           .LeftJoin<TB_Dic_ExamProvince>(TB_Dic_ExamProvince._.DicNO == TB_SignUpStudents._.ExamProvince)
            //           .LeftJoin<TB_Sys_ExamPlaceSpecialityKindsGroupMapping>(
            //           TB_Sys_ExamPlaceSpecialityKindsGroupMapping._.GroupNo == TB_Exam_SignUpStudentsSpeciality._.AppointmentGroup_First
            //           || TB_Sys_ExamPlaceSpecialityKindsGroupMapping._.GroupNo == TB_Exam_SignUpStudentsSpeciality._.AppointmentGroup_Second
            //           || TB_Sys_ExamPlaceSpecialityKindsGroupMapping._.GroupNo == TB_Exam_SignUpStudentsSpeciality._.AppointmentGroup_Third)
            //           .Select(TB_Exam_SignUpStudentsSpeciality._.All, TB_Dic_ExamProvince._.DicName, TB_SignUpStudentsNetPayFee_Detail._.Fee, TB_Sys_ExamPlaceSpecialityKindsGroupMapping._.GroupName,
            //           TB_SignUpStudents._.Name, TB_SignUpStudents._.LinkMobile, TB_SignUpStudents._.IdentityCard, TB_SignUpStudents._.NMT_SignUpID, TB_SignUpStudents._.Sex, TB_SignUpStudents._.ExamProvince,
            //           TB_Sys_SpecialityKinds._.SpecialityKindsName, TB_SignUpStudentsNetPayFee_Head._.PaySource, TB_Sys_ExamPlace._.ExamPlaceName)  //设置选择的字段数目 
            //            .AddSelect(
            //                        DbHelper.GetDatabase().From<TB_Dic_ExamLevel>()
            //                        .Where(TB_Dic_ExamLevel._.DicNO == TB_Exam_SignUpStudentsSpeciality._.ExamLevel)
            //                        .Select(TB_Dic_ExamLevel._.DicName), "ExamLevelName"
            //                        )
            //            .Page(pager.PageSize, pager.CurrentPage)  //分页显示
            //           .Where(pager.ComplexSearchCondition)
            //                            .OrderBy(pager.OrderBy)   //排序
            //           .ToDataTable();   //返回List

            //}
            return dt;
        }
        #endregion


        #region 获取 考生相关信息（考生信息查询）
        public DataTable GetExamineeOfAllInfo_ByBaseInfo(PagerCondition pager)
        {
            DataTable dt = new DataTable();
            pager.RecordCount = DbHelper.GetDatabase().From<TB_SignUpStudents>() //选择表                       
                        .LeftJoin<TB_Dic_ExamProvince>(TB_Dic_ExamProvince._.DicNO == TB_SignUpStudents._.ExamProvince)
                         .Select(TB_SignUpStudents._.All, TB_Dic_ExamProvince._.DicName)  //设置选择的字段数目
                        .Where(pager.ComplexSearchCondition)
                        .Count();
            #region 固定写法，判断当前页面对象删除后，当前页和最大页之间的关系
            if (pager.CurrentPage > pager.PageCount)
            {
                pager.CurrentPage = pager.PageCount;
            }
            if (pager.OrderBy == null)
                pager.OrderBy = new OrderByClip(TB_Exam_SignUpStudentsSpeciality._.CreatTime, OrderByOperater.DESC);
            #endregion

            dt = DbHelper.GetDatabase().From<TB_SignUpStudents>() //选择表
                    .LeftJoin<TB_Dic_ExamProvince>(TB_Dic_ExamProvince._.DicNO == TB_SignUpStudents._.ExamProvince)
                     .Select(TB_SignUpStudents._.All, TB_Dic_ExamProvince._.DicName)  //设置选择的字段数目 
                    .Page(pager.PageSize, pager.CurrentPage)  //分页显示
                    .Where(pager.ComplexSearchCondition)
                    .OrderBy(pager.OrderBy)   //排序
                    .ToDataTable();   //返回List
            return dt;
        }
        #endregion
    }
}
